package com.czkj.hwz.decorate.fragment;

import android.support.v4.app.Fragment;

import com.czkj.hwz.decorate.bean.Enterprise;

import java.util.HashMap;
import java.util.List;

/**
 * 作者：lxm on 2017/11/2 20:11
 * 邮箱：18014168291@189.cn
 * 才智科技
 */
public class FragmentFactory {
    public static HashMap<Integer,BaseOperationCenterFragment> BaseFragments=new HashMap<>();
    public static BaseOperationCenterFragment createFragment(int pos, int enterpriseid, String searchText, String mTitle) {
        BaseOperationCenterFragment baseOperationCenterFragment=BaseFragments.get(pos);
        if (baseOperationCenterFragment==null) {
            baseOperationCenterFragment=BaseOperationCenterFragment.newInstance(enterpriseid,searchText,mTitle);
            BaseFragments.put(pos,baseOperationCenterFragment);
        }
        return baseOperationCenterFragment;
    }
    public static HashMap<Integer,IndexProcuctFragment> indexProductFragments=new HashMap<>();
    public static IndexProcuctFragment createIndexProductFragment(int pos, int enterpriseid,String searchText,String mTitle) {
        IndexProcuctFragment indexProcuctFragment=indexProductFragments.get(pos);
        if (indexProcuctFragment==null) {
            indexProcuctFragment=IndexProcuctFragment.newInstance(enterpriseid,searchText,mTitle);
            indexProductFragments.put(pos,indexProcuctFragment);
        }
        return indexProcuctFragment;
    }
    public static HashMap<Integer,Fragment> indexFragments=new HashMap<>();
    public static Fragment createIndexFragment(int pos) {
        Fragment fragment=indexFragments.get(pos);
        if (fragment==null) {
            switch (pos) {
                case 0:
                    fragment=FirstFragment.newInstance();
                    break;
                case 1:
                    fragment=MessageFragment.newInstance();
                    break;
                case 2:
                    fragment=ShopFragment.newInstance("","");
                    break;
                case 3:
                    fragment=MineFragment.newInstance();
                    break;

            }
        }
        return fragment;
    }
}
